// 动态规划
// 原理：以斐波那契数列性质 f(n + 1) = f(n) + f(n - 1) 为转移方程
var fib = function (n) {
  let a = 0,
      b = 1,
      sum;
  for (let i = 0; i < n; i++) {
    sum = (a + b) % (1e9 + 7);
    a = b;
    b = sum;
  }
  return a;
}